package com.pms.service;



//import java.util.List;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

//import com.pms.domain.Operator;
//import com.pms.domain.Project;
import com.pms.domain.ProjectSaler;
//import com.pms.domain.Saler;
import com.pms.service.OperatorService;
import com.pms.service.ProjectSalerService;
import com.pms.service.ProjectService;
import com.pms.service.SalerService;

/**
 * @author ZZW
 *
 */
@RunWith(SpringJUnit4ClassRunner.class)  

@ContextConfiguration({"file:WebContent/WEB-INF/spring-main.xml","file:WebContent/WEB-INF/spring-mybatis.xml"})  
public class ServiceTest {
	
	@Autowired  
	OperatorService operatorService;
	
	@Autowired
	SalerService salerService;

	@Autowired
	ProjectService projectService;
	
	@Autowired
	ProjectSalerService projectSalerService;
    @Test
    public void testOperatorService(){
//    	System.out.println("start");
//    	Operator op = operatorService.selectByPrimaryKey(1);
//    	List<Operator> ops =  operatorService.getAll();
//    	System.out.println(ops.get(0).getOperatorName());
//    	Operator op = new Operator();
//    	op.setOperatorId(2);
//    	op.setOperatorName("联通");
//    	op.setOperatorType(3);
//    	operatorService.insertOperator(op);
//    	operatorService.updateByPrimaryKey(op);
//    	operatorService.deleteOperator(3);
//    	System.out.println(op.getOperatorName());
//    	System.out.println("end");
    }
    
    @Test
    public void testSalerService(){
//    	System.out.println("start");
//    	Saler saler = new Saler();
//    	saler.setActiveFlag("1");
//    	saler.setCardId("11111");
//    	saler.setEducation("本科");
//    	saler.setEmpId("02");
//    	saler.setName("zhansan");
//    	saler.setPhone("13100000000");
//    	saler.setPwd("123456");
//    	saler.setStoreCode("01");
//    	saler.setStoreName("北京四惠东移动营业厅");
//    	saler.setUserName("haha");
//    	saler.setWebchatNo("heihei");
//    	salerService.insertSaler(saler);
//    	Saler sal= salerService.selectByCardId("11111");
//    	System.out.println(sal.getName());
//    	salerService.updateByCardId(saler);
//    	salerService.deleteSalerByCardId("11111");
//    	System.out.println("end");
    }
    
    @Test
    public void testProjectService(){
//    	System.out.println("start....");
//    	Project project = new Project();
//    	project.setCreditFeeRate(0.1f);
//    	project.setInsuranceFeeRate1(0.1f);
//    	project.setInsuranceFeeRate2(0.1f);
//    	project.setOperatorType(1);
//    	project.setPartner("haha");
//    	project.setPartnerChannelFeeRate(0.1f);
//    	project.setPartnerDataFeeRate(0.1f);
//    	project.setProiectName("beijing2");
//    	project.setProjectId(1);
//    	project.setProjectType(2);
//    	project.setProvinceId("02");
//    	project.setUserinfoFlag("不可用");
//    	
//    	projectService.insertProject(project);
    	
//    	Project project1 = projectService.selectByPrimaryKey(2);
//    	System.out.println(project1.getProjectName());
    	
//    	projectService.updateByPrimaryKey(project);
//    	
//    	projectService.deleteProject(2);
//    	System.out.println("end");
    }
    
    @Test
    public void testProjectSalerService(){
    	System.out.println("start........");
    	ProjectSaler ps = new ProjectSaler();
    	ps.setDeleteFlag("删除");
    	ps.setProjectId(1);
    	ps.setProjectSalerId(1);
    	ps.setSalerId("03");
    	
//    	projectSalerService.insertProjectSaler(ps);
    	
//    	ProjectSaler projectSaler = projectSalerService.selectByPrimaryKey(1);
//    	System.out.println(projectSaler.getDeleteFlag());
    	
//    	projectSalerService.updateByPrimaryKey(ps);

    	projectSalerService.deleteProjectSaler(1);
    	
    	System.out.println("end");
    }
    
    
}
